package com.kg.tombs.entitys;

import io.vertx.core.json.JsonObject;
import lombok.Data;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 * 壁画
 */
@Data
public class Mural {

    /**
     * 壁画ID，唯一标识符
     */
    private Integer muralId;

    /**
     * 壁画位置
     */
    private String location;

    /**
     * 壁画内容描述
     */
    private String content;

    /**
     * 创建时间
     */
    private LocalDateTime createdAt;

    /**
     * 更新时间
     */
    private LocalDateTime updatedAt;

    public Mural(String location, String content, LocalDateTime createdAt, LocalDateTime updatedAt) {
        this.location = location;
        this.content = content;
        this.createdAt = createdAt;
        this.updatedAt = updatedAt;
    }

    public JsonObject toJson() {
        return new JsonObject()
                .put("location", location)
                .put("content", content)
                .put("createdAt", createdAt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")))
                .put("updatedAt", updatedAt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
    }
}
